WSetup.cpp


// WSetup.cpp : implementation file
//

#include "stdafx.h"
#include "JPEG.h"
#include "WSetup.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CJPEGWriteSetup dialog

// This is a trivial example of a settings UI dialog.  We store the width and height
// of the desired JPEG image in two data members, that we access in our automation object.

const int nDefaultHeight = 128;
const int nDefaultWidth = 128;

CJPEGWriteSetup::CJPEGWriteSetup(CWnd* pParent /*=NULL*/)
	: CDialog(CJPEGWriteSetup::IDD, pParent)
{
	//{{AFX_DATA_INIT(CJPEGWriteSetup)
	m_nHeight = nDefaultHeight;
	m_nWidth = nDefaultWidth;
	//}}AFX_DATA_INIT
}


void CJPEGWriteSetup::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJPEGWriteSetup)
	DDX_Text(pDX, IDC_JPEG_HEIGHT, m_nHeight);
	DDV_MinMaxUInt(pDX, m_nHeight, 1, 1024);
	DDX_Text(pDX, IDC_JPEG_WIDTH, m_nWidth);
	DDV_MinMaxUInt(pDX, m_nWidth, 1, 1024);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CJPEGWriteSetup, CDialog)
	//{{AFX_MSG_MAP(CJPEGWriteSetup)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static const TCHAR szJPEGFilter[] = _T("JPEG_Filter");
static const TCHAR szWidth[] = _T("Height");
static const TCHAR szHeight[] = _T("Width");

// Retrieve settings from the specified INI file.
// We use a (hopefully) unique section name to store our data.

void CJPEGWriteSetup::FromProfile(LPCTSTR szProfile)
{
	m_nWidth = ::GetPrivateProfileInt(szJPEGFilter, szWidth, nDefaultWidth, szProfile);
	m_nHeight = ::GetPrivateProfileInt(szJPEGFilter, szHeight, nDefaultHeight, szProfile);
}

// Save settings to the specified INI file.
// We use a (hopefully) unique section name to store our data.

void CJPEGWriteSetup::ToProfile(LPCTSTR szProfile)
{
	TCHAR szBuf[32];
	_itot(m_nWidth, szBuf, 10);
	::WritePrivateProfileString(szJPEGFilter, szWidth, szBuf, szProfile);
	_itot(m_nHeight, szBuf, 10);
	::WritePrivateProfileString(szJPEGFilter, szHeight, szBuf, szProfile);
}

/////////////////////////////////////////////////////////////////////////////
// CJPEGWriteSetup message handlers

SDK Top API Reference TurboCAD Home Page TurboCAD Programming Forums